﻿<UserControl x:Class="OnlinePlotsService.SimpleColorPicker"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    Width="212" Height="166">

    <UserControl.Resources>
        <ControlTemplate x:Key="ColorTemplate" TargetType="RadioButton">
            <Border x:Name="color" BorderThickness="1" BorderBrush="Transparent" Padding="2">
                <vsm:VisualStateManager.VisualStateGroups>
                    <vsm:VisualStateGroup x:Name="CheckStates">
                        <vsm:VisualState x:Name="Checked">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="color" Storyboard.TargetProperty="BorderBrush">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Red" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Unchecked"/>
                    </vsm:VisualStateGroup>

                    <vsm:VisualStateGroup x:Name="CommonStates">
                        <vsm:VisualState x:Name="Normal"/>
                        <vsm:VisualState x:Name="MouseOver">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="border" Storyboard.TargetProperty="BorderBrush">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Black" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </vsm:VisualState>
                        <vsm:VisualState x:Name="Pressed" />
                    </vsm:VisualStateGroup>
                </vsm:VisualStateManager.VisualStateGroups>
                <Border x:Name="border" BorderBrush="Gray" BorderThickness="1">
                    <Canvas Width="16" Height="17" Background="{TemplateBinding Background}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                </Border>
            </Border>
        </ControlTemplate>
        
        <Style x:Key="ColorStyle" TargetType="RadioButton">
            <Setter Property="GroupName" Value="colors" />
            <Setter Property="Margin" Value="2,2,0,0" />
        </Style>
        
        <Style x:Key="ColorsColumnStyle" TargetType="StackPanel">
            <Setter Property="Orientation" Value="Vertical" />
            <Setter Property="Width" Value="26" />
        </Style>
    </UserControl.Resources>

    <Border x:Name="LayoutRoot" BorderBrush="Black" Background="White" BorderThickness="1" Width="212" Height="166">
        <StackPanel x:Name="pMain" Orientation="Horizontal">
        </StackPanel>
    </Border>
</UserControl>
